find_package(Python3 COMPONENTS Development)
set(INCLUDEPY "${Python3_INCLUDE_DIRS}")
set(LIBPYTHON "${Python3_LIBRARIES}")
set(ZLOG_CLI_LIBS zlog)
set(GTEST_LIBS gtest gmock pthread jkutil zlog)
message("python include dir: ${INCLUDEPY}")
message("python lib: ${LIBPYTHON}")

set(ULFLAGS "-Wall -g -I. -DULAPI -D_GNU_SOURCE -DLOCALE_DIR=\"/usr/share/locale\" -DPACKAGE=\"jkzuc\" ")

execute_process(
	COMMAND	${JKZUC_ROOT_DIR}/tools/gen_pyvenv.sh
    OUTPUT_QUIET
)


set(JKTEST_TARGETS "" CACHE INTERNAL "List of all test targets")
set(JKTEST_MAIN ${JKZUC_ROOT_DIR}/test/testmain.cpp)
# 定义一个函数，用于增加测试
function(ADD_TEST target_name)
    # 解析函数参数，分别为源文件和链接的库
    set(options)
    set(oneValueArgs)
    set(multiValueArgs SOURCES LIBRARIES)
    cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

    # 创建可执行文件
    add_executable(${target_name} ${ARG_SOURCES})

    # 链接到指定的库
    target_link_libraries(${target_name} ${ARG_LIBRARIES} ${GTEST_LIBS})

    # 设置目标属性
    set_target_properties(${target_name} PROPERTIES 
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../test"
    )
    # 追加测试目标
    set(JKTEST_TARGETS ${target_name};${JKTEST_TARGETS} CACHE INTERNAL "List of all test targets")
endfunction()